﻿/**
 * @author sminutoli
 */
class com.dinmax.flash.draw.utilities.Easing {
	
	//EASE TYPES
	public static var NORMAL:Number = 0;
	public static var LOCO:Number = 1;
	//
	
	private var startPoint:Number;
	private var endPoint:Number;
	private var velocity:Number;
	private var duration:Number; //frames por segundo
	private var easeType:Number;
	
	public function Easing(startPoint:Number, endPoint:Number, velocity:Number, duration:Number, easeType:Number) {
		this.setStartPoint(startPoint);
		this.setEndPoint(endPoint);
		this.setVelocity(velocity);
		this.setDuration(duration);
		this.setEaseType(easeType);
	}
	
	public function getEaseType():Number {
		return easeType;
	}

	public function setEaseType(easeType:Number):Void {
		this.easeType = easeType;
	}

	public function getStartPoint():Number {
		return startPoint;
	}

	public function setStartPoint(startPoint:Number):Void {
		this.startPoint = startPoint;
	}

	public function getVelocity():Number {
		return velocity;
	}

	public function setVelocity(velocity:Number):Void {
		this.velocity = velocity;
	}

	public function getEndPoint():Number {
		return endPoint;
	}

	public function setEndPoint(endPoint:Number):Void {
		this.endPoint = endPoint;
	}
	
	public function getDuration():Number {
		return duration;
	}

	public function setDuration(duration:Number):Void {
		this.duration = duration;
	}
	
	public function getEasingPositions():Array {
		var easing:Array = new Array();
		var nPoint:Number = this.endPoint;
		
		while(nPoint > 0.5){
			//nPoint = (nPoint - this.startPoint) / this.velocity;
			nPoint = (nPoint - this.startPoint) / (this.duration/this.velocity);
			this.duration--;
			easing.push(this.endPoint - nPoint);	
		}
	 	return easing;
	};
	
};